﻿using System;
using System.Runtime.InteropServices;

namespace CamPlug.Api
{
	[Serializable]
	[StructLayout(LayoutKind.Sequential)]
	public struct BitmapInfo
	{
		public int Width { get; set; }
		public int Height { get; set; }
		public int[] ImageData { get; set; }

		public BitmapInfo(int width, int height)
			: this()
		{
			if (width < 1)
				throw new ArgumentOutOfRangeException("Width", "Must be greater than 0");
			if (height < 1)
				throw new ArgumentOutOfRangeException("Height", "Must be greater than 0");

			this.Width = width;
			this.Height = height;
			this.ImageData = new int[0];
		}

		public BitmapInfo(int width, int height, int[] imageData)
			: this(width, height)
		{
			if (imageData == null)
				throw new ArgumentNullException("ImageData");
			if (imageData.Length < 1)
				throw new ArithmeticException("ImageData cannot be empty");
		}

	}

}
